class Solution(object):
    def stoneGame(self, piles):
        """
        :type piles: List[int]
        :rtype: bool
        """
        L = len(piles)
        dp = [[0 for i in range(L)] for i in range(L)]
        for i in range(L):
            dp[i][i] = piles[i]
        
        for l in range(1, L):
            for i in range(0, L - l):
                j = i + l
                dp[i][j] = max(piles[i] - dp[i + 1][j], piles[j] - dp[i][j - 1])
        
        return dp[0][L-1] > 0:
